/*
 * job.h
 *
 *  Created on: 17/06/2011
 *      Author: Idan
 */

#ifndef JOB_H_
#define JOB_H_
#include "matrix.h"

class Job {
		int priority;
		const int jobID;
		static int isPriorityLegalReturn(int newPriority);
	protected:
		Matrix matrix1, matrix2;
	public:

		/*****************************************************************
		*	Exception types												 *
		*****************************************************************/
		class  JobException : public std::exception {};
		class  InvalidPriority : public JobException{};
		class  OperationFailed : public JobException{};
/*		c'tor - might throw an InvalidPriority exception, in case priority
		isn't positive.*/
		Job(const Matrix& A, const Matrix& B,int priority,const int jobID);
		int getJobID() const;
		int getPriority() const;
/*		change the job priority - might throw an InvalidPriority exception,
		 in case priority isn't positive.*/
		void changePriority(int newPriority);
		/*
		 * Execute a job, the class son's should implement their job.
		 * might throw an OperationFailed error, in case the operation failed.
		 * might throw Matrix::MatrixExceptions in case of the job will execute
		 * illegal operation on the matrix.
		 */
		virtual Matrix execute() = 0;
		virtual ~Job();

};
#endif /* JOB_H_ */
